﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Tecnorama.KasaSatis
{
    public partial class Musteri_Kayit_Formu : Form
    {
        public Musteri_Kayit_Formu()
        {
            InitializeComponent();
        }
        LinqDataContext db = new LinqDataContext();
        private void Musteri_Kayit_Formu_Load(object sender, EventArgs e)
        {

        }

        private void btnkaydet_Click(object sender, EventArgs e)
        {
            Musteriler musteri = new Musteriler();
            MusteriAdre mstriadres = new MusteriAdre();
            musteri.CepTelefonu = txtcep.Text;
            musteri.Cinsiyeti = rbkadin.Checked;
            musteri.KullaniciAdi = txtKullaniciadi.Text;
            musteri.SirketAdi = txtsirketadi.Text;
            musteri.DogumTarihi = dtdogumtarihi.Value;
            musteri.EvTelefonu = txtev.Text;
            musteri.TcKimlikNo = txtkimlikno.Text;
            musteri.UyelikTarihi = dtIsbaslangıc.Value;
            musteri.MusteriEmail = txtmail.Text;
            mstriadres.Adres = txtadres.Text;
            db.Musterilers.InsertOnSubmit(musteri);
            db.SubmitChanges();
            mstriadres.MusteriID = musteri.MusteriID;
            db.MusteriAdres.InsertOnSubmit(mstriadres);
            db.SubmitChanges();

            mstriadres.Adres = txtadres.Text;
           
        }

        private void groupBox1_Enter(object sender, EventArgs e)
        {

        }

        private void Musteri_Kayit_Formu_FormClosed(object sender, FormClosedEventArgs e)
        {
            KasaAnaGiris kasa = Application.OpenForms["KasaAnaGiris"] as KasaAnaGiris;
            kasa.Show();
        }

        private void dtIsbaslangıc_ValueChanged(object sender, EventArgs e)
        {

        }
    }
}
